# Varification of Parasites not Affecting Experiment
fileList <- c("HJ_CG_JeanLangh_JW_220813_Sample_Probe_Profile.txt")
x.lumi <- lumiR.batch(fileList = fileList, lib.mapping = 'lumiMouseIDMapping', convertNuID = T)
## Inputting the data ...
##
## Adding nuID to the data ...
## Loading required package: lumiMouseIDMapping
## Perform Quality Control assessment of the LumiBatch object ...
# pData <- read.csv("SampleInfo_GEO.csv", row.names = 1)
# Remove bad samples
badsamp <- c("8697771087_E","8697771096_F")
toremove <- pData(x.lumi)$sampleID %in% badsamp
x.lumi.badremove = x.lumi[,-which(toremove)]
detDat <- detection(x.lumi.badremove)
ggplot(data=melt(detDat), aes(x = Var2, y = value)) +
geom_violin() +
geom_boxplot(width=0.1) +
theme(axis.text.x = element_text(angle = 90, hjust = 1)) +
ggtitle("Detection Pval") +
xlab("Sample") +
ylab("Detection Pval")

True_Detection <- as.data.frame(colSums(detection(x.lumi.badremove) <= 0.01 ))
ggplot(data = True_Detection, aes(x = rownames(True_Detection), y = True_Detection[,1], group = 1)) +
geom_line() +
theme(axis.text.x = element_text(angle = 90, hjust = 1)) +
xlab("Samples") +
ggtitle("True Detection") +
ylab("Detected Probes")

###Generate QC plots
plot(x.lumi.badremove, what = 'density')

plotCDF(x.lumi.badremove, reverse = T)

# plot(x.lumi.badremove, what = 'pair')
pairs(x.lumi.badremove, smoothScatter = T)

MAplot(x.lumi.badremove, smoothScatter = T)
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'
## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter

plot(x.lumi.badremove, what = 'boxplot')

plot(x.lumi.badremove, what = 'sampleRelation')

plotSampleRelation(x.lumi.badremove, method = 'mds')

plotSampleRelation(x.lumi.badremove, method = 'cluster')

# Data from Blood
fileList <- c("HJ_CG_JeanLangh_JW_220813_Sample_Probe_Profile.txt",
"HJ_JLanghorne_NoURNA_bkgsubt_NoNorm_110913_Sample_Probe_Profile.txt",
"HJ_JWL_181213_NouRNA_Bkg_subt_noNorm_SampleProbeProfile.txt",
"HJ_JingWen_7chip__011113_NouRNA_NoParasite_Bkg_Subtracted_No_Norm_Sample_Probe_Profile.txt")
x.lumi <- lumiR.batch(fileList = fileList, lib.mapping = 'lumiMouseIDMapping', convertNuID = T)
## Inputting the data ...
##
## Adding nuID to the data ...
## Perform Quality Control assessment of the LumiBatch object ...
pData <- read.csv("SampleInfo_GEO.csv", row.names = 1)
x.lumi.GEO <- x.lumi[,match(pData$"slot", x.lumi$sampleID)]
sampleNames(x.lumi.GEO) <- rownames(pData[match(x.lumi.GEO$sampleID,
pData[,"slot"]),])
pData(x.lumi.GEO) <- pData
x.lumi.GEO.AS <- x.lumi.GEO[,x.lumi.GEO$type == "AS"]
x.lumi.GEO.AS.blood <- x.lumi.GEO.AS[,x.lumi.GEO.AS$tissue == "blood"]
detDat <- detection(x.lumi.GEO.AS.blood)
ggplot(data=melt(detDat), aes(x = Var2, y = value)) +
geom_violin() +
geom_boxplot(width=0.1) +
theme(axis.text.x = element_text(angle = 90, hjust = 1)) +
ggtitle("Detection Pval") +
xlab("Sample") +
ylab("Detection Pval")

True_Detection <- as.data.frame(colSums(detection(x.lumi.GEO.AS.blood) <= 0.01 ))
ggplot(data = True_Detection, aes(x = rownames(True_Detection), y = True_Detection[,1], group = 1)) +
geom_line() +
theme(axis.text.x = element_text(angle = 90, hjust = 1)) +
xlab("Samples") +
ggtitle("True Detection") +
ylab("Detected Probes")

###Generate QC plots
plot(x.lumi.GEO.AS.blood, what = 'density')

plotCDF(x.lumi.GEO.AS.blood, reverse = T)

# plot(x.lumi.GEO.AS.blood, what = 'pair')
pairs(x.lumi.GEO.AS.blood, smoothScatter = T)

MAplot(x.lumi.GEO.AS.blood, smoothScatter = T)
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'
## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter

plot(x.lumi.GEO.AS.blood, what = 'boxplot')

plotSampleRelation(x.lumi.GEO.AS.blood, method = 'mds')

plotSampleRelation(x.lumi.GEO.AS.blood, method = 'cluster')

##Do default VST variance stabilizing transform
# x.lumi.sub.B <- lumiB(x.lumi.sub, method = 'forcePositive')
x.lumi.sub.T <- lumiT(x.lumi.GEO.AS.blood, method = 'vst')
## Perform vst transformation ...
## 2019-11-21 15:03:48 , processing array 1
## 2019-11-21 15:03:48 , processing array 2
## 2019-11-21 15:03:48 , processing array 3
## 2019-11-21 15:03:48 , processing array 4
## 2019-11-21 15:03:48 , processing array 5
## 2019-11-21 15:03:48 , processing array 6
## 2019-11-21 15:03:48 , processing array 7
## 2019-11-21 15:03:48 , processing array 8
## 2019-11-21 15:03:48 , processing array 9
## 2019-11-21 15:03:48 , processing array 10
## 2019-11-21 15:03:48 , processing array 11
## 2019-11-21 15:03:48 , processing array 12
## 2019-11-21 15:03:48 , processing array 13
## 2019-11-21 15:03:48 , processing array 14
## 2019-11-21 15:03:48 , processing array 15
## 2019-11-21 15:03:48 , processing array 16
## 2019-11-21 15:03:48 , processing array 17
## 2019-11-21 15:03:49 , processing array 18
## 2019-11-21 15:03:49 , processing array 19
## 2019-11-21 15:03:49 , processing array 20
## 2019-11-21 15:03:49 , processing array 21
## 2019-11-21 15:03:49 , processing array 22
## 2019-11-21 15:03:49 , processing array 23
## 2019-11-21 15:03:49 , processing array 24
## 2019-11-21 15:03:49 , processing array 25
##Plot VST transformation
trans <- plotVST(x.lumi.sub.T)

matplot(log2(trans$untransformed), trans$transformed)

##Do quantile between microarray normaliazation
x.lumi.sub.TN <- lumiN(x.lumi.sub.T)
## Perform quantile normalization ...
##Do quality control estimation after normalization
x.lumi.sub.TNQ <- lumiQ(x.lumi.sub.TN)
## Perform Quality Control assessment of the LumiBatch object ...
###Generate QC plots after normalisation
plot(x.lumi.sub.TNQ, what = 'density')

plotCDF(x.lumi.sub.TNQ, reverse = T)

plot(x.lumi.sub.TNQ, what = 'boxplot')

# plot(x.lumi.sub.TNQ, what = 'pair')
pairs(x.lumi.sub.TNQ, smoothScatter = T)

MAplot(x.lumi.sub.TNQ, smoothScatter = T)
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'
## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter

plotSampleRelation(x.lumi.sub.TNQ, method = 'mds')

plotSampleRelation(x.lumi.sub.TNQ, method = 'cluster')

# The PCA plot of the vst-transformed raw expression data
exp_raw <- exprs(x.lumi.sub.TNQ)
PCA_raw <- prcomp(t(exp_raw), scale. = FALSE)
percentVar <- round(100*PCA_raw$sdev^2/sum(PCA_raw$sdev^2),1)
sd_ratio <- sqrt(percentVar[2] / percentVar[1])
dataGG <- data.frame(PC1 = PCA_raw$x[,1], PC2 = PCA_raw$x[,2],
infection = pData(x.lumi.GEO.AS.blood)$"infection",
day = pData(x.lumi.GEO.AS.blood)$"day")
ggplot(dataGG, aes(PC1, PC2)) +
geom_point(aes(shape = infection, colour = day)) +
ggtitle("PCA plot of the vst-transformed raw expression data") +
xlab(paste0("PC1, VarExp: ", percentVar[1], "%")) +
ylab(paste0("PC2, VarExp: ", percentVar[2], "%")) +
theme(plot.title = element_text(hjust = 0.5))+
coord_fixed(ratio = sd_ratio) +
scale_shape_manual(values = c(4,15)) +
scale_color_manual(values = c("#999999", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00"))

# Data from Spleen
x.lumi.GEO.AS.spleen <- x.lumi.GEO.AS[,x.lumi.GEO.AS$tissue == "spleen"]
detDat <- detection(x.lumi.GEO.AS.spleen)
ggplot(data=melt(detDat), aes(x = Var2, y = value)) +
geom_violin() +
geom_boxplot(width=0.1) +
theme(axis.text.x = element_text(angle = 90, hjust = 1)) +
ggtitle("Detection Pval") +
xlab("Sample") +
ylab("Detection Pval")

True_Detection <- as.data.frame(colSums(detection(x.lumi.GEO.AS.spleen) <= 0.01 ))
ggplot(data = True_Detection, aes(x = rownames(True_Detection), y = True_Detection[,1], group = 1)) +
geom_line() +
theme(axis.text.x = element_text(angle = 90, hjust = 1)) +
xlab("Samples") +
ggtitle("True Detection") +
ylab("Detected Probes")

###Generate QC plots
plot(x.lumi.GEO.AS.spleen, what = 'density')

plotCDF(x.lumi.GEO.AS.spleen, reverse = T)

# plot(x.lumi.GEO.AS.spleen, what = 'pair')
# pairs(x.lumi.GEO.AS.spleen, smoothScatter = T)
MAplot(x.lumi.GEO.AS.spleen, smoothScatter = T)
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'
## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter

plot(x.lumi.GEO.AS.spleen, what = 'boxplot')

plotSampleRelation(x.lumi.GEO.AS.spleen, method = 'mds')

plotSampleRelation(x.lumi.GEO.AS.spleen, method = 'cluster')

##Do default VST variance stabilizing transform
x.lumi.sub.T <- lumiT(x.lumi.GEO.AS.spleen, method = 'vst')
## Perform vst transformation ...
## 2019-11-21 15:05:12 , processing array 1
## 2019-11-21 15:05:12 , processing array 2
## 2019-11-21 15:05:12 , processing array 3
## 2019-11-21 15:05:12 , processing array 4
## 2019-11-21 15:05:12 , processing array 5
## 2019-11-21 15:05:12 , processing array 6
## 2019-11-21 15:05:12 , processing array 7
## 2019-11-21 15:05:12 , processing array 8
## 2019-11-21 15:05:12 , processing array 9
## 2019-11-21 15:05:13 , processing array 10
## 2019-11-21 15:05:13 , processing array 11
## 2019-11-21 15:05:13 , processing array 12
## 2019-11-21 15:05:13 , processing array 13
## 2019-11-21 15:05:13 , processing array 14
## 2019-11-21 15:05:13 , processing array 15
## 2019-11-21 15:05:13 , processing array 16
## 2019-11-21 15:05:13 , processing array 17
## 2019-11-21 15:05:13 , processing array 18
## 2019-11-21 15:05:13 , processing array 19
## 2019-11-21 15:05:13 , processing array 20
## 2019-11-21 15:05:13 , processing array 21
## 2019-11-21 15:05:13 , processing array 22
## 2019-11-21 15:05:13 , processing array 23
## 2019-11-21 15:05:13 , processing array 24
## 2019-11-21 15:05:13 , processing array 25
## 2019-11-21 15:05:13 , processing array 26
## 2019-11-21 15:05:13 , processing array 27
##Plot VST transformation
trans <- plotVST(x.lumi.sub.T)

matplot(log2(trans$untransformed), trans$transformed)

##Do quantile between microarray normaliazation
x.lumi.sub.TN <- lumiN(x.lumi.sub.T)
## Perform quantile normalization ...
##Do quality control estimation after normalization
x.lumi.sub.TNQ <- lumiQ(x.lumi.sub.TN)
## Perform Quality Control assessment of the LumiBatch object ...
###Generate QC plots after normalisation
plot(x.lumi.sub.TNQ, what = 'density')

plotCDF(x.lumi.sub.TNQ, reverse = T)

plot(x.lumi.sub.TNQ, what = 'boxplot')

# plot(x.lumi.sub.TNQ, what = 'pair')
# pairs(x.lumi.sub.TNQ, smoothScatter = T)
MAplot(x.lumi.sub.TNQ, smoothScatter = T)
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'
## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter
## Warning in KernSmooth::bkde2D(x, bandwidth = bandwidth, gridsize = nbin, :
## Binning grid too coarse for current (small) bandwidth: consider increasing
## 'gridsize'

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter

## Warning in plot.window(...): "smoothScatter" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "smoothScatter" is not a graphical
## parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...):
## "smoothScatter" is not a graphical parameter
## Warning in box(...): "smoothScatter" is not a graphical parameter
## Warning in title(...): "smoothScatter" is not a graphical parameter

plotSampleRelation(x.lumi.sub.TNQ, method = 'mds')

plotSampleRelation(x.lumi.sub.TNQ, method = 'cluster')

# The PCA plot of the vst-transformed raw expression data
exp_raw <- exprs(x.lumi.sub.TNQ)
PCA_raw <- prcomp(t(exp_raw), scale. = FALSE)
percentVar <- round(100*PCA_raw$sdev^2/sum(PCA_raw$sdev^2),1)
sd_ratio <- sqrt(percentVar[2] / percentVar[1])
dataGG <- data.frame(PC1 = PCA_raw$x[,1], PC2 = PCA_raw$x[,2],
infection = pData(x.lumi.GEO.AS.spleen)$"infection",
day = pData(x.lumi.GEO.AS.spleen)$"day")
ggplot(dataGG, aes(PC1, PC2)) +
geom_point(aes(shape = infection, colour = day)) +
ggtitle("PCA plot of the vst-transformed raw expression data") +
xlab(paste0("PC1, VarExp: ", percentVar[1], "%")) +
ylab(paste0("PC2, VarExp: ", percentVar[2], "%")) +
theme(plot.title = element_text(hjust = 0.5))+
coord_fixed(ratio = sd_ratio) +
scale_shape_manual(values = c(4,15)) +
scale_color_manual(values = c("#999999", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00"))

# fileList <- c("HJ_CG_JeanLangh_JW_220813_Sample_Probe_Profile.txt",
# "HJ_JLanghorne_NoURNA_bkgsubt_NoNorm_110913_Sample_Probe_Profile.txt",
# "HJ_JWL_181213_NouRNA_Bkg_subt_noNorm_SampleProbeProfile.txt",
# # "HJ_JingWen_7chip__011113_Allsamples_Bkg_Subtracted_No_Norm_Sample_Probe_Profile.txt")
# "HJ_JingWen_7chip__011113_NouRNA_NoParasite_Bkg_Subtracted_No_Norm_Sample_Probe_Profile.txt")
#
#
# x.lumi <- lumiR.batch(fileList = fileList, lib.mapping = 'lumiMouseIDMapping', convertNuID = T)
# pData <- read.csv("SampleInfo_GEO.csv", row.names = 1)
# x.lumi.sub <- x.lumi[,sample.info$SampleID]
# if (is.null(sample.info$summary)){
# sample.info <- cbind(sample.info, summary=do.call(paste, c(sample.info[,c(2,3,4)], sep = "_")))
# }
# sampleNames(x.lumi.sub) <- make.names(sample.info[c(match(sample.info$SampleID, x.lumi$sampleID)),"summary"], uniq=T)
#
# randIDs <- sample(featureNames(x.lumi.sub), 1000)
#
# detDat <- detection(x.lumi.sub[randIDs, ])
# ggplot(data=melt(detDat), aes(x = Var2, y = value)) +
# geom_violin() +
# geom_boxplot(width=0.1) +
# theme(axis.text.x = element_text(angle = 90, hjust = 1)) +
# ggtitle("Detection Pval") +
# xlab("Sample") +
# ylab("Detection Pval")
#
#
# ###Generate QC plots
#
# plot(x.lumi.sub, what = 'density')
# plotCDF(x.lumi.sub, reverse = T)
# # plot(x.lumi.sub, what = 'pair')
# # pairs(x.lumi.sub, smoothScatter = T)
# # MAplot(x.lumi.sub, smoothScatter = T)
# plot(x.lumi.sub, what = 'boxplot')
# plot(x.lumi.sub, what = 'sampleRelation')
# plotSampleRelation(x.lumi.sub, method = 'mds')
# plotSampleRelation(x.lumi.sub, method = 'cluster')
#
# no.parasite <- sample.info[sample.info$parasite == 'No', ]
# # ord=match(x=sampleNames(IFNARKO),table=bp.info$SampleID)
# x.lumi.sub.no.paratite <- x.lumi[,no.parasite$SampleID]
# sampleNames(x.lumi.sub.no.paratite) <- make.names(no.parasite[,"summary"], uniq=T)
#
#
# randIDs <- sample(featureNames(x.lumi.sub.no.paratite), 1000)
#
# detDat <- detection(x.lumi.sub.no.paratite[randIDs, ])
# ggplot(data=melt(detDat), aes(x = Var2, y = value)) +
# geom_violin() +
# geom_boxplot(width=0.1) +
# theme(axis.text.x = element_text(angle = 90, hjust = 1)) +
# ggtitle("Detection Pval") +
# xlab("Sample") +
# ylab("Detection Pval")
#
#
# ###Generate QC plots
#
# plot(x.lumi.sub.no.paratite, what = 'density')
# plotCDF(x.lumi.sub.no.paratite, reverse = T)
# # plot(x.lumi.sub.no.paratite, what = 'pair')
# # pairs(x.lumi.sub.no.paratite, smoothScatter = T)
# # MAplot(x.lumi.sub.no.paratite, smoothScatter = T)
# plot(x.lumi.sub.no.paratite, what = 'boxplot')
# plot(x.lumi.sub.no.paratite, what = 'sampleRelation')
# plotSampleRelation(x.lumi.sub.no.paratite, method = 'mds')
# plotSampleRelation(x.lumi.sub.no.paratite, method = 'cluster')
# ## Removing bad sample
#
# # sampleNames(x.lumi.sub.no.paratite) = pData(x.lumi.sub.no.paratite)$sampleID
# # badsamp <- c("8697771096_F")
# # toremove <- pData(x.lumi.sub.no.paratite)$sampleID %in% badsamp
# # x.lumi.sub.no.paratite.badremove = x.lumi.sub.no.paratite[,-which(toremove)]
#
#
# x.lumi.GEO <- x.lumi[,match(pData$"slot", x.lumi$sampleID)]
#
#
# sampleNames(x.lumi.GEO) <- rownames(pData[match(x.lumi.GEO$sampleID,
# pData[,"slot"]),])
# pData(x.lumi.GEO) <- pData
#
#
# x.lumi.GEO.AS <- x.lumi.GEO[,x.lumi.GEO$type == "AS"]
#
#
#
# plot(x.lumi.GEO.AS, what = 'density')
# plotCDF(x.lumi.GEO.AS, reverse = T)
# # plot(x.lumi.GEO, what = 'pair')
# # pairs(x.lumi.GEO, smoothScatter = T)
# # MAplot(x.lumi.GEO, smoothScatter = T)
# plot(x.lumi.GEO.AS, what = 'boxplot')
# oligo::boxplot(x.lumi.GEO.AS, target = "core",
# main = "Boxplot of raw data")
# # plot(x.lumi.GEO, what = 'sampleRelation')
# plotSampleRelation(x.lumi.GEO.AS, method = 'mds')
# plotSampleRelation(x.lumi.GEO.AS, method = 'cluster')
#
# ##Do default VST variance stabilizing transform
#
# # x.lumi.sub.B <- lumiB(x.lumi.sub, method = 'forcePositive')
# x.lumi.sub.T <- lumiT(x.lumi.GEO.AS, method = 'vst')
#
# # The PCA plot of the vst-transformed raw expression data
# exp_raw <- exprs(x.lumi.sub.T)
# PCA_raw <- prcomp(t(exp_raw), scale. = FALSE)
#
# percentVar <- round(100*PCA_raw$sdev^2/sum(PCA_raw$sdev^2),1)
# sd_ratio <- sqrt(percentVar[2] / percentVar[1])
#
# dataGG <- data.frame(PC1 = PCA_raw$x[,1], PC2 = PCA_raw$x[,2],
# infection = pData(x.lumi.GEO.AS)$"infection",
# type = pData(x.lumi.GEO.AS)$"tissue")
#
# ggplot(dataGG, aes(PC1, PC2)) +
# geom_point(aes(shape = infection, colour = type)) +
# ggtitle("PCA plot of the vst-transformed raw expression data") +
# xlab(paste0("PC1, VarExp: ", percentVar[1], "%")) +
# ylab(paste0("PC2, VarExp: ", percentVar[2], "%")) +
# theme(plot.title = element_text(hjust = 0.5))+
# coord_fixed(ratio = sd_ratio) +
# scale_shape_manual(values = c(4,15)) +
# scale_color_manual(values = c("darkorange2", "dodgerblue4"))
#
# oligo::boxplot(x.lumi.sub.T, target = "core",
# main = "Boxplot of vst-transformed data")
#
# ##Plot VST transformation
#
# trans <- plotVST(x.lumi.sub.T)
# matplot(log2(trans$untransformed), trans$transformed)
#
# ##Do quantile between microarray normaliazation
# x.lumi.sub.TN <- lumiN(x.lumi.sub.T)
#
# ##Do quality control estimation after normalization
# x.lumi.sub.TNQ <- lumiQ(x.lumi.sub.TN)
#
# ###Generate QC plots after normalisation
#
# plot(x.lumi.sub.TNQ, what = 'density')
# plotCDF(x.lumi.sub.TNQ, reverse = T)
# plot(x.lumi.sub.TNQ, what = 'boxplot')
#
# # plot(x.lumi.sub.TNQ, what = 'pair')
# # pairs(x.lumi.sub.TNQ, smoothScatter = T)
# # MAplot(x.lumi.sub.TNQ, smoothScatter = T)
# plotSampleRelation(x.lumi.sub.TNQ, method = 'mds')
# plotSampleRelation(x.lumi.sub.TNQ, method = 'cluster')
#
# # The PCA plot of the normalized expression data
# exp_raw <- exprs(x.lumi.sub.TNQ)
# PCA_raw <- prcomp(t(exp_raw), scale. = FALSE)
#
# percentVar <- round(100*PCA_raw$sdev^2/sum(PCA_raw$sdev^2),1)
# sd_ratio <- sqrt(percentVar[2] / percentVar[1])
#
# dataGG <- data.frame(PC1 = PCA_raw$x[,1], PC2 = PCA_raw$x[,2],
# infection = pData(x.lumi.GEO.AS)$"infection",
# type = pData(x.lumi.GEO.AS)$"tissue")
#
# ggplot(dataGG, aes(PC1, PC2)) +
# geom_point(aes(shape = infection, colour = type)) +
# ggtitle("PCA plot of the normalized expression data") +
# xlab(paste0("PC1, VarExp: ", percentVar[1], "%")) +
# ylab(paste0("PC2, VarExp: ", percentVar[2], "%")) +
# theme(plot.title = element_text(hjust = 0.5))+
# coord_fixed(ratio = sd_ratio) +
# scale_shape_manual(values = c(4,15)) +
# scale_color_manual(values = c("darkorange2", "dodgerblue4"))
#
# oligo::boxplot(x.lumi.sub.TNQ, target = "core",
# main = "Boxplot of normalized data")
# # Relative Log Expression data quality analysis
# palmieri_eset <- rma(x.lumi.sub.TNQ, target = "core", normalize = FALSE)
#
# row_medians_assayData <-
# Biobase::rowMedians(as.matrix(Biobase::exprs(x.lumi.sub.TNQ)))
#
# RLE_data <- sweep(Biobase::exprs(x.lumi.sub.TNQ), 1, row_medians_assayData)
#
# RLE_data <- as.data.frame(RLE_data)
# RLE_data_gathered <-
# tidyr::gather(RLE_data, patient_array, log2_expression_deviation)
#
# ggplot2::ggplot(RLE_data_gathered, aes(patient_array,
# log2_expression_deviation)) +
# geom_boxplot(outlier.shape = NA) +
# ylim(c(-2, 2)) +
# theme(axis.text.x = element_text(colour = "aquamarine4",
# angle = 60, size = 6.5, hjust = 1 ,
# face = "bold"))
# ###Write expression results matrix
#
# # write.exprs(x.lumi.TNQ, file = 'IFNARKO_lumiTNQ_matrix.txt')
#
# ###Differential expression analysis
#
# ##Remove unexpressed genes
#
# presentCount <- detectionCall(x.lumi.GEO)
# selDataMatrix <- x.lumi.sub.TNQ[presentCount > 0,]
# probeList <- rownames(selDataMatrix)
#
# ###Define sample groups
#
# sampleType <- pData(x.lumi.GEO)$"infection:ch1"
#
# ###Create comparative design
#
# design <- model.matrix(~ 0 + factor(sampleType))
# colnames(design) <- c('naïve', 'AS', 'CB')
# design
#
# ###Fit model
#
# x.lumi.fit <- lmFit(selDataMatrix, design)
# x.lumi.fit <- eBayes(x.lumi.fit)
#
# ## Add gene symbols to gene properties
# if (require(lumiMouseAll.db) & require(annotate)) {
# geneSymbol <- getSYMBOL(probeList, 'lumiMouseAll.db')
# geneName <- sapply(lookUp(probeList, 'lumiMouseAll.db', 'GENENAME'), funct
# fit$genes <- data.frame(ID= probeList, geneSymbol=geneSymbol, geneName=gen
# }
#
# ##Make contrasts
#
# contrast.matrix <- makeContrasts(naïve - AS, levels = design)
#
# ##Re-fit
#
# x.lumi.fit2 <- contrasts.fit(x.lumi.fit, contrast.matrix)
#
# x.lumi.fit2 <- eBayes(x.lumi.fit2)
#
#
# topTable(x.lumi.fit2, adjust.method = 'fdr', number = 40, lfc = 0.3, sort.by = 'p')
# BS.beadarray <- readBeadSummaryData(dataFile = "HJ_JLanghorne_NoURNA_bkgsubt_NoNorm_110913_Sample_Probe_Profile.txt",
# skip = 7,
# ProbeID="ProbeID",
# columns = list(exprs = "AVG_Signal", se.exprs="BEAD_STDEV",
# nObservations = "Avg_NBEADS", Detection="Detection"),
# illuminaAnnotation = "Mousev2"
# )
#
# ids <- as.character(rownames(BS.beadarray))
# rownames(BS.beadarray) <- unlist(mget(ids, revmap(illuminaMousev2ARRAYADDRESS), ifnotfound = NA ))
#
# BS.beadarray <- addFeatureData(BS.beadarray, toAdd = c("SYMBOL", "PROBEQUALITY", "CODINGZONE", "PROBESEQUENCE"), annotation ="Mousev2")
#
# fData(BS.beadarray)$Status <-
# ifelse(fData(BS.beadarray)$PROBEQUALITY=="No match","negative","regular" )
#
# BS.neqc <- normaliseIllumina(BS.beadarray, method="neqc", transform="none")
#
#
# qual <- fData(BS.beadarray)$PROBEQUALITY
#
# rem <- qual == "No match" | qual == "Bad" | is.na(qual)
# BS.filt <- BS.neqc[!rem,]